package com.example.travel.controller;

import com.example.travel.entity.*;
import com.example.travel.entity.bo.OrderformBO;
import com.example.travel.entity.dto.*;
import com.example.travel.service.IAdminSelectService;
import com.example.travel.util.ResultUtil;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/AdminSelectController")
public class AdminSelectController {

    @Autowired
    private IAdminSelectService adminSelectService;

    /**
     * 查询用户注册人数
     * @return
     */
    @GetMapping("/queryRegNumber")
    public int queryRegNumber(){
        return adminSelectService.queryRegNumber();
    }

    /**
     * 分页查询用户信息
     * @param userDTO
     * @return
     */
    @GetMapping("/queryUserPage")
    public ResultUtil queryUserPage(UserDTO userDTO){
        PageInfo<User> userPageInfo = adminSelectService.queryUserPage(userDTO);
        return ResultUtil.ok(userPageInfo);
    }

    /**
     * 查询酒店订单信息
     * @param orderformDTO
     * @return
     */
    @GetMapping("/queryOrderForm")
    public ResultUtil queryOrderForm(OrderformDTO orderformDTO){
        PageInfo<OrderformBO> userPageInfo = adminSelectService.queryOrderForm(orderformDTO);
        return ResultUtil.ok(userPageInfo);
    }

    /**
     * 管理员查询酒店信息
     */
    @GetMapping("/queryHotelInformation")
    public ResultUtil queryHotelInformation(HotelDTO hotelDTO){
        PageInfo<Hotel> userPageInfo = adminSelectService.queryHotelInformation(hotelDTO);
        return ResultUtil.ok(userPageInfo);
    }

    /**
     * 查询景点订单信息
     * @param orderformDTO
     * @return
     */
    @GetMapping("/queryScenicOrderForm")
    public ResultUtil queryScenicOrderForm(OrderformDTO orderformDTO){
        PageInfo<OrderformBO> userPageInfo = adminSelectService.queryScenicOrderForm(orderformDTO);
        return ResultUtil.ok(userPageInfo);
    }

    /**
     * 查询景点信息
     * @param scenicDTO
     * @return
     */
    @GetMapping("/queryScenicInformation")
    public ResultUtil queryScenicInformation(ScenicDTO scenicDTO){
        PageInfo<Scenic> userPageInfo = adminSelectService.queryScenicInformation(scenicDTO);
        return ResultUtil.ok(userPageInfo);
    }

    /**
     * 查询轮播图信息
     * @return
     */
    @GetMapping("/queryScenicBannerInformation")
    public List<ScenicImg> queryScenicBannerInformation(){
        return adminSelectService.queryScenicBannerInformation();
    }


    @GetMapping("/queryFestivalInformation")
    public ResultUtil queryFestivalInformation(FestivalDTO festivalDTO){
        PageInfo<Festival> pageInfo = adminSelectService.queryFestivalInformation(festivalDTO);
        return ResultUtil.ok(pageInfo);
    }

    /**
     * 查询酒店营收
     * @return
     */
    @GetMapping("/selectHotelOrderNumber")
    public int selectHotelOrderNumber(){
        return adminSelectService.selectHotelOrderNumber();
    }

    /**
     * 查询景点营收
     * @return
     */
    @GetMapping("/selectScenicOrderNumber")
    public int selectScenicOrderNumber(){
        return adminSelectService.selectScenicOrderNumber();
    }

    /**
     * 查询留言
     * @param leaveDTO
     * @return
     */
    @GetMapping("/queryLeave")
    public ResultUtil queryLeave(LeaveDTO leaveDTO){
        return ResultUtil.ok(adminSelectService.queryLeave(leaveDTO));
    }

}
